<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../style/css/shoppingcart.css" />
<script type="text/javascript" src="../style/js/book.js"></script>
<script type="text/javascript" src="../style/js/order.js"></script>
<title>我的购物车</title>
</head>
<body>
	<%@include file="head.jsp" %>
	<div id="content">
	<c:if test="${sessionScope.cart.getItmes().values().size()>0}">
		<table id="books">
			<tr class="title">
				<th class="check"><input type="checkbox" class="point" onclick="checkPoint('checkAll')" checked="checked" />全选</th>
				<th class="bookName">商品</th>
				<th class="bookPrice">单价（元）</th>
				<th class="bookNumPoint">数量</th>
				<th class="bookNumPrice">小计（元）</th>
				<th class="bookDelete">操作</th>
			</tr>
			<c:forEach items="${sessionScope.cart.getItmes().values()}" var="c">
			<tr class="orderInfo" id="orderInfo_${c.item.id}">
				<th class="check" ><input type="checkbox" class="point" id="check_${c.item.id}" value="${c.item.ISBN}" onclick="checkPoint()" checked="checked" /></th>
				<th class="bookName">
					<a href="bookInfo.jsp?book=${c.item.id}"><img src="../style/img/book_logo/${c.item.picPath}"></a>
					<a href="bookInfo.jsp?book=${c.item.id}">${c.item.title }</a>
				</th>
				<th class="bookPrice">${c.item.unprice }</th>
				<th class="bookNumPoint">
					<input type="button" class="btnReduce" value="-" onclick="bookNumChange(${c.item.id},'reduce')"/>
					<input type="text" id="booknum_${c.item.id}" class="bookNum" value="${c.amount }" 
						onkeyup="this.value=this.value.replace(/\D/g,'')" 
						onblur="this.value=this.value>0?this.value:'${c.amount}';bookNumChange(${c.item.id},'')"/>
					<input type="button" class="btnAdd" value="+" onclick="bookNumChange(${c.item.id},'add')" />
				</th>
				<th class="bookNumPrice">${c.amount*c.item.unprice}</th>
				<th class="bookDelete"><a href="javascript:void(0)" onclick="bookDelete(${c.item.id })">删除</a></th>
			</tr>
			</c:forEach>
			<tr class="orderEnd">
				<th></th>
				<th><a href="javascript:void(0)" onclick="bookClean()">清空购物车</a></th>
				<th></th>
				<th></th>
				<th><span>￥${sessionScope.cart.total}</span></th>
				<th><a class="orderBook" href="javascript:void(0)" onclick="commitOrders()">结算</a></th>
			</tr>
		</table>
	</c:if>
	<c:if test="${sessionScope.cart.getItmes().values()==null||sessionScope.cart.getItmes().values().size()==0}">
		<div class="message">
			购物车内暂时没有商品
		</div>
	</c:if>
	</div>
	<%@include file="footer.jsp" %>
</body>
</html>
